<template>
	<view class="content">
	        <view class="row b-b">
	            <text class="tit">姓名</text>
	            <input class="input" type="text" v-model="uname" placeholder="请输入姓名" placeholder-class="placeholder" />
	        </view>
	        <view class="row b-b">
	            <text class="tit">身份证号</text>
	            <input class="input" type="text" v-model="uidn" placeholder="请输入身份证号" placeholder-class="placeholder" />
	        </view>
	        <view class="row b-b">
	            <text class="tit">密码</text>
	            <input class="input" type="number" v-model="upassword" placeholder="请输入密码" placeholder-class="placeholder" />
	        </view>
	        <button class="add-btn" @click="confirm">提交</button>
	    </view>
</template>

<script>
	export default {
		data() {
			return {
				uname:"",
				uidn:"",
				upassword:""
			}
		},
		methods: {
			confirm:function(){
				let password = uni.getStorageSync('password');
				let uid = uni.getStorageSync('username');
				if(password != this.upassword){
					uni.showToast({title: "密码不正确", icon:"none"});
				}else{
					uni.request({
						url: 'http://116.62.213.195/login.php',
						data:{
							method: 'ujoin',
							username:uid,
							name: this.uname,
							idnumber: this.uidn
						},
						header: {'content-type' : "application/x-www-form-urlencoded"},
						method:'POST',
						success: res =>{
							if(res.data.code == '200'){
						        uni.showToast({title: "加入成功"+res.data.data, icon:"none"});
								uni.setStorageSync('mumber',1);
						    }else{
						        uni.showToast({title: "加入失败，请检查用户名和密码"+res.data.data, icon:"none"});
						    }
						}
					});
				}
			}
		}
	}
</script>

<style lang="scss">
    page {
        padding-top: 16upx;
    }
 
    .row {
        display: flex;
        align-items: center;
        position: relative;
        padding: 0 30upx;
        height: 110upx;
        background: #fff;
 
        .tit {
            flex-shrink: 0;
            width: 120upx;
            font-size: 30upx;
 
        }
 
        .input {
            flex: 1;
			margin-left: 6px;
            font-size: 30upx;
 
        }
 
        .icon-shouhuodizhi {
            font-size: 36upx;
 
        }
    }
 
    .add-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 690upx;
        height: 80upx;
        margin: 60upx auto;
        background-color: rgb(28, 42, 134);
        color: #fff;
 
        border-radius: 10upx;
        box-shadow: 1px 2px 5px rgba(28, 42, 134, 0.4);
    }
</style>
